package com.tsl.prevention.util;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

@Component
public class RabbitMQGetMessage {

    @RabbitListener(bindings = @QueueBinding(value = @Queue(value = "hello"), //监听 队列
            exchange = @Exchange(value = "test",type = "fanout"))) //选择指定交换机
    public void get(@Payload String message) {
        System.out.println(message);
    }
}
